lib/repo-pull: Fix free function for hash table
authorMatthew Leeds <matthew.leeds@endlessm.com>
Thu, 1 Mar 2018 00:06:31 +0000 (16:06 -0800)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 1 Mar 2018 14:10:24 +0000 (14:10 +0000)
The "ref_original_commits" hash table uses string values, not variants,
so fix the free function passed to g_hash_table_new_full (). Since
g_variant_unref isn't NULL safe, this prevents an assertion failure when
a NULL value is inserted.

Dan Nicholson suggested this patch; I'm just submitting it because he's
busy.

Fixes https://github.com/ostreedev/ostree/issues/1433

Closes: #1474
Approved by: cgwalters

src/libostree/ostree-repo-pull.c

index 999d7ecf64640fbcb08376c2276a4798096df21d..75de5bdd2811a9418b18a3e9a5abc3e9ab958c98 100644 (file)
@@ -3365,7 +3365,7 @@ ostree_repo_pull_with_options (OstreeRepo             *self,
                                                                (GDestroyNotify)g_free);
   pull_data->ref_original_commits = g_hash_table_new_full (ostree_collection_ref_hash, ostree_collection_ref_equal,
                                                            (GDestroyNotify)NULL,
-                                                           (GDestroyNotify)g_variant_unref);
+                                                           (GDestroyNotify)g_free);
   pull_data->gpg_verified_commits = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                            (GDestroyNotify)g_free, NULL);
   pull_data->scanned_metadata = g_hash_table_new_full (ostree_hash_object_name, g_variant_equal,